package tencent;

import java.util.Scanner;

/** 
  * @author  outsider
  * @date 创建时间：2016年4月3日 下午8:01:06 
  * @note
*/
class Demo{
	 public static void main(String args[]){
	    Scanner scanner=new Scanner(System.in);
	    int n=scanner.nextInt();
	    int[][] ans=new int[n][n];
	    for (int i=1;i<=n;i++)
	      ans[0][i-1]=i;
	    int x=n-1,y=0,limitStep=n-1,step=0,forward=0,now=n+1;
	    while (now<=n*n){
	      if (forward==0) y++;
	      if (forward==1) x--;
	      if (forward==2) y--;
	      if (forward==3) x++;
	      ans[y][x]=now;
	      now++;
	      step++;
	      if (step==limitStep){
	        step=0;
	        forward=(forward+1) %4;
	        if ((forward==0)||(forward==2)) limitStep--;
	      }
	    }
	    for (int j=0;j<n;j++)
	      for (int i=0;i<n;i++)
	        System.out.print(ans[j][i]+" ");
	    
	}
}
